/**
 * 
 */
package de.tuhh.simsearch.constants;

import java.util.HashMap;

/**
 * Constants contains the constants used in the project.
 * 
 * The content type is represented by an integer in the backend and a string at the client. This class also contains a
 * mapping between both representations.
 * 
 * This class also contains the enumerations FilterType and SearchTypes.
 * 
 * FilterType contains the types of filters which can be applied.
 * 
 * SearchTypes contains the fields which can be searched in the indexer.
 * 
 * @author SimSearch 1
 * 
 */
public class Constants {

  public static final int MusicContentID = 1;
  public static final String MusicContentDesc = "Music";
  public static final int PictureContentID = 2;
  public static final String PictureContentDesc = "Picture";
  public static final int TextContentID = 3;
  public static final String TextContentDesc = "Text";

  public static final HashMap<Integer, String> contentIdDescMap;
  public static final HashMap<String, Integer> descContentIdMap;

  /**
   * static initialization block for the contentIDMap
   */
  static {
    contentIdDescMap = new HashMap<Integer, String>();
    contentIdDescMap.put(MusicContentID, MusicContentDesc);
    contentIdDescMap.put(PictureContentID, PictureContentDesc);
    contentIdDescMap.put(TextContentID, TextContentDesc);

    descContentIdMap = new HashMap<String, Integer>();
    descContentIdMap.put(MusicContentDesc, MusicContentID);
    descContentIdMap.put(PictureContentDesc, PictureContentID);
    descContentIdMap.put(TextContentDesc, TextContentID);
  }

  /**
   * Contains the string value for the role 'user'
   */
  public static final String UserRole = "USER";

  /**
   * Contains the string value for the role 'admin'
   */
  public static final String AdminRole = "ADMIN";

  /**
   * The FilterType contains all possible filter options.
   * 
   * @author SimSearch 1
   * 
   */
  public enum FilterType {
    /**
     * No filter
     */
    NONE,
    /**
     * Filter for trusted users
     */
    TRUSTFUL_USERS,
    /**
     * Filter for preferences
     */
    PREFERENCES,
    /**
     * Filter for trusted users and preferences
     */
    BOTH
  }

  /**
   * Contains the fields that can be searched in the indexer
   * 
   * @author SimSearch 1
   * 
   */
  public enum SearchTypes {
    /**
     * Search in the file names
     */
    NAMES,
    /**
     * Search in the description
     */
    DESCRIPTION,
    /**
     * Search in the category names or content types
     */
    CATEGORIES,
    /**
     * Search within the content, when possible
     */
    CONTENT,
    /**
     * Search in available metadata
     */
    METADATA
  }
}
